package com.weng.cloud.service8881.mybatis.mapper.provider;

import com.weng.cloud.service8881.mybatis.entity.PlayerEntity;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @Author: weng
 * @Date: 2022/3/14
 * @Description: com.weng.cloud.service8881.mybatis.mapper.provider
 */
public class PlayerProvider {

    //此处官方建议参数使用final修饰
    //权限使用public修饰
    public String testSQLBuilder(final String id){
        return new SQL()
            .SELECT("*")
            .FROM("t_player")
            .WHERE("id = #{id}")
            .toString()
        ;
    }

    public String testTransactional(final PlayerEntity player){
        return new SQL()
            .INSERT_INTO("t_player")
            .VALUES("no","#{player.no}")
            .VALUES("name","#{player.name}")
            .VALUES("time","#{player.time}")
            .toString()
        ;
    }
}
